package com.example.pattern.composite;

/**
 * 应用
 *
 * @author FM_南风
 * @date 2024/7/3 13:56
 */
public class CompositeClient {
    public static void main(String[] args) {
        ConcreteDepartment salesDepartment = new ConcreteDepartment("A");
        ConcreteDepartment marketingDepartment = new ConcreteDepartment("B");

        CompositeDepartment headDepartment = new CompositeDepartment("C");
        headDepartment.addDepartment(salesDepartment);
        headDepartment.addDepartment(marketingDepartment);

        ConcreteDepartment financeDepartment = new ConcreteDepartment("D");
        headDepartment.addDepartment(financeDepartment);

        headDepartment.printDepartmentName();
    }
}

